import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class Test {
    //旋转数组

    public static int [] spinArray(int [] arr,int k){
        int len = Array.getLength(arr);
        int [] newArr = new int[len];
        for (int i = 0; i < len; i++) {
            newArr[(i + k) % len] = arr[i];
        }
        return Arrays.copyOf(newArr,len);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int [] array = {1,2,3,4,5,6,7};
        int k = scan.nextInt();
        System.out.println(Arrays.toString(spinArray(array, k)));
    }
}
